import {IGoodsPageRow, IStoreGoodsPageRow, IStoreProductRow} from "@/api/modules/pointsMall";

/**
 * 会员等级列表项
 */
export interface IRankItem {
  id: number;
  memberLogo: string;
  memberName: string;
  memberLevel: number | undefined | null;
  levelDescription: string;
  memberLevel_cn?: string;
}

/**
 * 会员等级新增form表单
 */
export interface IVipRankAddData {
  memberLogo: string;
  memberName: string;
  levelDescription: string;
  memberCode: string;
  memberSuperior: number | null;
  memberSubordinate: number | null;
  configId: number | null;
  externalMemberConfigId: number | string | null;
  growth: number | undefined;
}

/**
 * 会员等级用户查询参数
 */
export interface IRankUserData {
  gradleId: number | null,
  phone: string,
  nickName: string,
  // queryInsIds: number[]
}

/**
 * 会员等级用户列表项
 */
export interface IRankUserItem {

}

/**
 * 会员任务查询参数
 */
export interface IRankTaskData {
  memberId: number | null,
  name: string,
  categoryInfoId: number[],
  taskType: string,
  status: number | null,
  // insId: number[]
}

/**
 * 会员任务列表项
 */
export interface IRankTaskItem {
  id: number,
  name: string
}

/**
 * 新增会员任务
 */
export interface IRankTaskEditData {
  memberId: number | null,
  taskId: number | null,
  name: string,
  description: string,
  img: string,
  granularity: number | null,
  count: number | null
  payOfCurrencyId: number | null,
  payOfCurrencyCount: number | null,
  goodsId: number | null,
  productId: number | null,
  growth: number | null;
  growthExpireType: number | null;
  growthExpireDays: number | null;
  id?: number | null,
}


/**
 * 会员等级权益 查询参数
 */
export interface IRankBenefitsData {
  memberId: number | null, // 会员等级ID
  goodsName: string,
  storeId: number | null, // 供应商
  // insIds: number[],
}

/**
 * 会员等级权益
 */
export interface IRankBenefitItem {
  id: number,
  memberGoodsDetailVo: any,
  timeType: 'all' | 'week' | 'month' | 'quarter',
  limitNum: string,
}

/**
 * 获取商家商品详情 查询参数
 */
export interface IStoreGoodsDetailData {
  id: string,
}

/**
 * 获取商家商品详情 响应
 */
export interface IStoreGoodsDetailRes {
  name: string,
  thumbnailUrl: string,
  products: IStoreProductRow[]
}

export interface IRankUser {
  id: number,
  phone: number,
}


/**
 * 会员等级规则
 */
export interface IRuleRes {
  rule: string,
}

export interface IMemberConfigRes extends IMemberConfigEditData{
}

/**
 * 会员等级规则
 */
export interface IVipRankRuleData {
  rule: string
}

export interface IMemberConfigEditData {
  memberType: 1 | 2; // 内部 | 外部
  validityType: 1 | 2; // 1 日 2 月
  validityPeriod: number | undefined;
  keepGrade: 1 | 0; // 1 是 2 否
  payConfigId: number | undefined;
  memberRule: string;
  memberConfigId: number | undefined;
}

/**
 * 支付配置数据
 */
export interface IPayConfigData {

}

/**
 * 支付配置项
 */
export interface IPayConfigItem {

}

/**
 * 新增 礼品包 提交数据
 */
export interface IAddGiftPackData {
  name: string,
  thumbnailUrl: string,
  packNum: number,
  addOrDeductionStockCount: number,
  goodsEntities: IGiftPackGoodsEntity[],
  type: 'pack',
  products: Omit<IAddGiftPackData, 'goodsEntities' | 'products'>[]
}

// 礼品包奖品(商品)
export interface IGiftPackGoodsEntity {
  storeGoodsId: number,
  name: string,
  thumbnailUrl: string,
  detailText: string,
  description: string,
  addOrDeductionStockCount: number,
  products: IGiftPackGoodProduct[],
  type: string,
  storeId: number,
  storeName: string,
  parentId?: number,
}

// 礼品包奖品规格(商品规格)
export interface IGiftPackGoodProduct {
  storeGoodsId: number,
  storeProductId: number,
  name: string,
  thumbnailUrl: string,
  addOrDeductionStockCount: number,
  beforeStock: number
  stock?: number
}

export interface IUpdateGiftPackData {
  name: string,
  thumbnailUrl: string,
  packNum: number,
  originalPrice: number,
  showMinCurrencyPrice: number,
  showMinPrice: number,
  description: string,
  products: IGiftPackGoodProduct[]
  addOrDeductionStockCount: number
  totalStock?: number,
  stock?: number,
}
